/**
 * Project Name:YCApiServer-Api
 * File Name:MusicianController.java
 * Package Name:com.yc.music.controller.Api.common
 * Date:2016年8月13日 下午3:08:48
 * Copyright (c) 2016 
 *
 */
package com.yc.music.controller.Api.common;

import java.util.HashMap;
import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.yc.music.common.context.YcContext;
import com.yc.music.service.service21.MusicActivityService;
import com.yc.music.service.service21.MusicActivityUserService;
import com.yc.music.service.service21.MusicActivityWorkService;

/**
 * 
 * ClassName: WorkController <br/>
 * Function: 音乐人模块. <br/>
 * Reason: TODO ADD REASON(可选). <br/>
 * date: 2016年8月13日 下午3:08:48 <br/>
 *
 * @author qinhaiguan
 * @version
 */
@Controller
@RequestMapping("/common/activity")
public class MusicCommonActivityController {

	private static Logger logger = Logger.getLogger(MusicCommonActivityController.class);
	
	@Autowired
	private MusicActivityService musicActivityService;
	
	@Autowired
	private MusicActivityWorkService musicActivityWorkService;
	
	@Autowired
	private MusicActivityUserService musicActivityUserService;

	
	/**
	 * 
	 * musicActivityList:活动列表. <br/> 
	 *
	 * @author qinhaiguan
	 * @param page
	 * @return
	 * @since JDK 1.7
	 */
	@ResponseBody
	@RequestMapping(value="/list", method = RequestMethod.POST, produces = "application/json")
	public Map<String,Object> musicActivityList(
			@RequestParam(value="page",required=false) Integer page) {
		Map<String,Object> result  = new HashMap<String,Object>();
		try {
//			musicActivityService.getMusicActivityList(page, result);
		} catch (Exception e) {
			result.put(YcContext.CODE, 500);
			result.put(YcContext.MESSAGE, YcContext.SYS_ERROR_MSG);
			result.put(YcContext.DATA,YcContext.EMPTY_STRING);
			logger.error(e);
		}
		return result;
	}
	
	/**
	 * 
	 * musicActivityDetail:获取活动详情. <br/> 
	 * @author qinhaiguan
	 * @param aid  //活动id
	 * @return
	 * @since JDK 1.7
	 */
	@ResponseBody
	@RequestMapping(value="/actdetail", method = RequestMethod.POST, produces = "application/json")
	public Map<String,Object> musicActivityDetail(
			@RequestParam(value="aid",required=false) Integer aid,
			@RequestParam(value="uid",required=false) Long uid) {
		Map<String,Object> result  = new HashMap<String,Object>();
		try {
			musicActivityService.getMusicActivityDetail(aid,uid,result);
		} catch (Exception e) {
			result.put(YcContext.CODE, 500);
			result.put(YcContext.MESSAGE, YcContext.SYS_ERROR_MSG);
			result.put(YcContext.DATA,YcContext.EMPTY_STRING);
			logger.error(e);
		}
		return result;
	}
	
	
	/**
	 * 
	 * activityUser:获取用户. <br/> 
	
	 * @author qinhaiguan
	 * @param aid  活动id
	 * @param page  页码
	 * @return
	 * @since JDK 1.7
	 */
	@ResponseBody
	@RequestMapping(value="/userlist", method = RequestMethod.POST, produces = "application/json")
	public Map<String,Object> activityUser(@RequestParam(value="aid", required=false) Integer aid,
			@RequestParam(value="page", required=false) Integer page) {
		Map<String,Object> result = new HashMap<String,Object>();
		try {
			musicActivityUserService.musicActivityUser(aid, page, result);
		} catch (Exception e) {
			result.put(YcContext.CODE, 500);
			result.put(YcContext.MESSAGE, YcContext.SYS_ERROR_MSG);
			result.put(YcContext.DATA,YcContext.EMPTY_STRING);
			logger.error(e);
		}
		return result;
	}
	
	
	@ResponseBody
	@RequestMapping(value="/worklist", method = RequestMethod.POST, produces = "application/json")
	public Map<String,Object> musicActivityWorkList(
			@RequestParam(value="aid",required=false) Integer aid,
			@RequestParam(value="type",required=false) Integer type,
			@RequestParam(value="sort",required=false) Integer sort,
			@RequestParam(value="page",required=false) Integer page) {
		Map<String,Object> result  = new HashMap<String,Object>();
		try {
			musicActivityWorkService.musicActivityWorkList(aid, type, sort, page, result);
		} catch (Exception e) {
			result.put(YcContext.CODE, 500);
			result.put(YcContext.MESSAGE, YcContext.SYS_ERROR_MSG);
			result.put(YcContext.DATA,YcContext.EMPTY_STRING);
			logger.error(e);
		}
		return result;
	}
	
	
	@ResponseBody
	@RequestMapping(value="/overlist", method = RequestMethod.POST, produces = "application/json")
	public Map<String,Object> musicActivityoverList(
			@RequestParam(value="aid",required=false) Integer aid) {
		Map<String,Object> result  = new HashMap<String,Object>();
		try {
			musicActivityWorkService.musicActivityOverList(aid, result);
		} catch (Exception e) {
			result.put(YcContext.CODE, 500);
			result.put(YcContext.MESSAGE, YcContext.SYS_ERROR_MSG);
			result.put(YcContext.DATA,YcContext.EMPTY_STRING);
			logger.error(e);
		}
		return result;
	}
	
	
}
